/*------------------------------------------------------*/
/*                                                      */
/* Copyright (C)	sky-mobi.com                        */
/* All rights reserved                                  */
/*                                                      */
/* Author   tristan.yang                                */
/*                                                      */
/* History  2011-5-10 created                           */
/*                                                      */
/*------------------------------------------------------*/

#ifndef __RSCENTER_MGR_H__
#define __RSCENTER_MGR_H__

#include "database.h"
#include "rcdbevent.h"
#include "httpevent.h"

class CRsRoomSink
{
public:
	CRsRoomSink(){}
	virtual ~CRsRoomSink(){};
public:
	virtual void OnFecthUserInfo(RtResult aResult, const s_UserInfo& info) = 0;
	virtual void OnFecthRoomList(RtResult aResult, const RoomDetailMap& mapRoomDetails) = 0;
};

class CRsCenterMgr
: public CRtReferenceControlSingleThread
{
public: 
	CRsCenterMgr();
	virtual ~CRsCenterMgr();
	
	RtResult Initialize(
		const char* strDBHost,
		const char* strDBName,
		const char* strUserName,
		const char* strPassword,
		WORD nThreadNumber,
		WORD nDbType);

	RtResult Initialize2(
		const char* strDBHost,
		unsigned short nPort,
		const char* strDBName,
		const char* strUserName,
		const char* strPassword,
		WORD nThreadNumber,
		WORD nDbType);

	virtual RtResult FecthUserInfo(CRsRoomSink* pSink, int nNodeID, int nUsrID, const CRtString& strSession);
	virtual RtResult FecthRoomList(CRsRoomSink* pSink);

private:
	CRtAutoPtr<CDBThreadManager>	m_pDBTreadMgr;
};

#endif//__RSCENTER_MGR_H__
